package com.rupertjones.globalcron.web;

import com.rupertjones.globalcron.domain.Host;
import net.sourceforge.stripes.validation.TypeConverter;
import net.sourceforge.stripes.validation.ValidationError;

import java.util.Collection;
import java.util.Locale;

/**
 * <p>&copy Rupert Jones 2011,2012</p>
 *
 * @author rup
 */
public class HostConverter implements TypeConverter<Host> {

    @Override
    public void setLocale(Locale locale) {
    }

    @Override
    public Host convert(String formValue, Class<? extends Host> aClass, Collection<ValidationError> validationErrors) {
        Host host = new Host();
        host.setId(Integer.parseInt(formValue));
        return host;
    }
}
